

class BaseModel {
  constructor(model) {
    this._model = model
  }

  one(filter = {}) {
    return this._model.findOne(filter)
  }

  all(filter = {}) {
    return this._model.find(filter)
  }

  create(data) {
    return this._model.create(data)
  }

  update(filter, data) {
    return this._model.updateMany(fitler, { $set: data })
  }

  delete(filter) {
    return this._model.deleteMany(filter)
  }
}


module.exports = BaseModel